﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using System.Linq;
using System.Text;

namespace VisualExamEngine
{
    class clsStringListTypeConverter : TypeConverter
    {
        public override object ConvertTo(ITypeDescriptorContext context,
           CultureInfo culture, object value, Type destinationType)
        {
            List<String> v = value as List<String>;
            if (destinationType == typeof(string))
            {
                return string.Join(", ", v.ToArray());
            }
            else if (v.Count <= 0)
            {
                return ("(none)");
            }
            
            return base.ConvertTo(context, culture, value, destinationType);
        }
    }
}
